<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStudentBuy extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('student_buy', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('student_id')->comment("学员id");
            $table->integer('member_number')->default(0)->comment("购买次数");
            $table->integer('surplus_number')->default(0)->comment("已使用次数");
            $table->tinyInteger('stu_status')->default(0)->comment("课程分类 0团课，1私课");
            $table->decimal('amount',10,2)->default('0.00')->comment("购买金额");
            $table->integer('teacher_id')->default(0)->comment("私教授课老师");
            $table->integer('begin_time')->default(0)->comment("会员开启时间");
            $table->integer('end_time')->default(0)->comment("会员到期时间");
            $table->tinyInteger('status')->default(0)->comment("状态 0启用，1禁用");
            $table->integer('created_at')->default(0)->comment("创建时间");
            $table->index('stu_status');
            $table->index('status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('student_buy');
    }
}
